Skip to content

fix(worktree-reaper): enumerate ignored files in the CLEAN gate (#6734) - #6749

Closed
dezren39 wants to merge 1 commit into
mainfrom
queue/fb-6734-reaper-ignored-gate
Closed

dezren39 wants to merge 1 commit into
mainfrom
queue/fb-6734-reaper-ignored-gate

Conversation

@dezren39

@dezren39 dezren39 commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Closes #6734

Summary

The worktree-reaper's CLEAN gate never enumerated ignored files, so a worktree whose only non-tracked content was ignored (local state, ignored databases, scratch) classified clean and was reaped — git worktree remove deleted the ignored content with the tree, unrecorded in the run record, breaking the reaper's "only removes worktrees whose content is proven on origin" invariant (ignored content is by definition never on origin).

  • status_entries() now also returns ignored paths via git status --ignored=matching (!! entries; probe-verified: ignored files list individually, ignored directories collapse to one trailing-slash entry like target/, so records stay compact). Both call sites — the CLEAN gate in evaluate_tree and the re-verification in reap_tree — fail closed on any ignored path beyond the new ignored-dirt allowlist.
  • New ignored_allowlisted() mirrors dirt_allowlisted plus component matching (build output sits at any depth): config keys ignored_dirt_names (any path component; seeded target, node_modules, __pycache__, .direnv in both DEFAULT_CONFIG and the shipped config.json), ignored_dirt_prefixes, ignored_dirt_files. This is the allowlist seed judgment lane code-t's triage delegated to the fix claim: known regenerable build output only — an unlisted ignored path always blocks, never rides along.
  • reap_tree records every allowlisted ignored path it is about to delete on the run record (ignored_removed) before the removal runs, and allowlisted ignored dirt justifies --force exactly like allowlisted untracked dirt.
  • README + module docstring CLEAN descriptions now state the ignored-files rule explicitly.

Evidence

  • python3 tests/test_worktree_reaper.py (laptop): 15 passed / 0 failed — the full existing reap matrix plus new coverage: test_05_ignored_gate (ignored-only tree kept with local-state named in the gate's ignored_other; allowlisted-untracked + unlisted-ignored tree kept; allowlisted-ignored target/ tree reaped with target/ in the record's ignored_removed), test_ignored_allowlisted (component/prefix/basename matching; target_notes.txt is not target/; unlisted ignored content fails closed), test_status_entries_enumerates_ignored (synthetic repo: ignored file + collapsed ignored dir enumerated, untracked/tracked unaffected).
  • Triage verdict (lane code-t, CONFIRMED with a synthetic-repo probe: status_entries returned ([], []) for an ignored-only worktree) is on worktree-reaper: CLEAN gate is blind to ignored files — an ignored-only tree reaps as clean and git worktree remove deletes the ignored content unrecorded #6734; the fix implements its routed plan.

Merge Danger

Door: two-way — reaper gate logic only, single-commit revert.

Blast Radius: the laptop worktree-reaper's CLEAN decisions. The change only ever keeps more trees (unlisted ignored content now blocks) or records more (allowlisted ignored paths are named before a reap that was already going to happen); no tree that is kept today gets reaped unless its ignored content is entirely within the named build-output allowlist.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…ignored content blocks the reap, allowlisted ignored paths are recorded before removal (#6734)
@dezren39
dezren39 requested a review from a team as a code owner November 7, 2026 03:44
@coderabbitai

coderabbitai Bot commented Nov 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 55 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2dce6eee-028f-4bd6-a185-4e1aefb743cc
Commits

Reviewing files that changed from the base of the PR and between c86d831 and ff164e8.

Files selected for processing: 4

  • infra/worktree-reaper/README.md
  • infra/worktree-reaper/bin/worktree_reaper.py
  • infra/worktree-reaper/config.json
  • infra/worktree-reaper/tests/test_worktree_reaper.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T03:46:52.423773Z ff164e8 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39

dezren39 commented Nov 7, 2026

Copy link
Copy Markdown
Member Author

Superseded by merged PR #6748 (lane code-t's implementation of the same #6734 fix, landed while this duplicate was in flight). Salvage check posted on #6748: diffed against merge commit 953bf96 — nothing unique to salvage. Closing per the duplicate-PR protocol.

@dezren39 dezren39 closed this Nov 7, 2026
@dezren39
dezren39 deleted the queue/fb-6734-reaper-ignored-gate branch November 7, 2026 03:46
@dezren39
dezren39 restored the queue/fb-6734-reaper-ignored-gate branch November 8, 2026 04:30
@dezren39
dezren39 deleted the queue/fb-6734-reaper-ignored-gate branch November 14, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant